package com.milo.thread.create.callable;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * <p>
 *     Callable实现类
 * </p>
 * @author Milo Lee
 * @date 2019/4/2015:43
 */
public class MyCallable implements Callable<Integer> {

    @Override
    public Integer call() throws Exception {

        System.out.println("子线程在进行计算");

        TimeUnit.MILLISECONDS.sleep(100);
        int sum = 0;
        for (int i = 0; i < 100; i++)
            sum += i;
        return sum;
    }

}
